import React from 'react'
import style from './Right.module.scss'
import { Button } from "antd"
import { useDispatch } from 'react-redux'
import { btnList } from '../constant'
import { addQuestion } from '../../../../store/models/questions'

const Right:React.FC = () => {
  const dispatch = useDispatch()


  return (
    <div className={style.right}>
          <p>栏目</p>
          {btnList.map(item => 
            <Button key={item.type} type="primary"
            onClick={() => {
              dispatch( addQuestion({
                type:item.type,
                title:item.text,
                list:[]
            }))
          }}>{item.text}</Button>
          )}
        </div>
  )
}

export default Right